package com.ojoin.trade.t0loan_core.web.controller;

 
import javax.servlet.http.HttpServletRequest;

import com.ojoin.trade.common.utils.CommonUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.ojoin.trade.common.web.controller.SimpleBaseController;

@Controller
public class MappingController  extends SimpleBaseController {

	@RequestMapping(value = "/user/{page}", method = RequestMethod.GET)
    public String user(@PathVariable("page") String page,HttpServletRequest request,RedirectAttributes redirectAttributes) {
        return "/user/"+page+".html";
    }

    @RequestMapping(value = "/trade/{page}", method = RequestMethod.GET)
    public String trade(@PathVariable("page") String page) {
        return "/trade/"+page+".html";
    }
    
    @RequestMapping(value = "/supplyloan/{page}", method = RequestMethod.GET)
    public String supplyloan(@PathVariable("page") String page) {
        return "/supplyloan/"+page+".html";
    }
	
	@RequestMapping(value = "/admin/{page}", method = RequestMethod.GET)
    public String admin(@PathVariable("page") String page) {
        return "/admin/"+page+".html";
    }

	@RequestMapping(value = "/operate/{page}", method = RequestMethod.GET)
    public String operate(@PathVariable("page") String page) {
        if(page.equals("operatelogin")&&CommonUtils.getPrincipal() != null){
            return "redirect:/operate/index.html";
        }
        return "/operate/"+page+".html";
    }
	
	@RequestMapping(value = "/sys/{page}", method = RequestMethod.GET)
    public String sys(@PathVariable("page") String page) {
        return "/sys/"+page+".html";
    }

}
